using System;
using System.Text.RegularExpressions;

namespace CWare.CMetrics.Core
{
public class CSharpCodeLine
{

    public string Content
    {
        get;
        protected set;
    }

    public CSharpCodeLine(string content)
    {
        Content = content;
    }

    public bool isEmpty
    {
        get
        {
            return Regex.IsMatch(Content, @"^\s*$");
        }
    }

    public bool isNotEmpty
    {
        get
        {
            return ! isEmpty;
        }
    }

    public bool isSingleLineComment
    {
        get
        {
            return Regex.IsMatch(Content, @"^\s*//.*$");
        }
    }

    public bool isMultipleLineCommentStart
    {
        get
        {
            return Regex.IsMatch(Content, @"^\s*/\*.*$");
        }
    }

    public bool isMultipleLineCommentContinuation
    {
        get
        {
            return Regex.IsMatch(Content, @"^\s*\*.*$");
        }
    }

    public bool isMultipleCommentLineEnd
    {
        get
        {
            return Regex.IsMatch(Content, @"^\s*\*/.*$");
        }
    }

    public bool isSingleBracket
    {
        get
        {
            return Regex.IsMatch(Content, @"^\s*[\{\}]\s*$");
        }
    }

    public bool isEffectiveCodeLine
    {
        get
        {
            return !
                   (
                       isEmpty | isSingleLineComment | isMultipleLineCommentStart
                       | isMultipleLineCommentContinuation | isMultipleCommentLineEnd
                       | isSingleBracket
                   );
        }
    }

}
}
